﻿@model S4Store.Models.FinancialReport.FwxslHistoryModel
@{
    Layout = null;
    ViewBag.Title = "FwxslHistory";

    S4Store.Models.Chart.Line ChartModel1 = new S4Store.Models.Chart.Line();
    ChartModel1.Name = "各车型服务吸收率历史数据";
    ChartModel1.YAxis = "比例(%)";
    foreach(var brand in Model.CarBrands){
        S4Store.Models.Chart.ChartSeries series = new S4Store.Models.Chart.ChartSeries();
        series.Name = brand.Name;
        for (DateTime dt = Model.Start; dt <= Model.End; dt = dt.AddMonths(1))
        {
            var report = Model.Reports.FirstOrDefault(t => t.CarBrand.Id == brand.Id && t.Year == dt.Year && t.Month == dt.Month);
            if(report==null){
                report = new S4Store.Domain.FinancialReport.CarBrandFinancialReport();
            }
            series.Data.Add(report.FWXSLV);
        }
        ChartModel1.Serieses.Add(series);
    }    
    for(DateTime dt=Model.Start;dt<=Model.End;dt=dt.AddMonths(1)){
        ChartModel1.XAxis.Add(dt.ToString("M月"));
    }

}
<div style="height:100%; width:100%; overflow:auto">
@Html.Action("ReportBar", "Common", Model.BarModel)
@Html.Partial("../Chart/Line", ChartModel1)

</div>